package com.zr.hibernateutil;

import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;

public class HibernateUtil {
	 private static final SessionFactory sf = bulidSessionFactory();
	 private  static SessionFactory bulidSessionFactory(){
		 Configuration  config  = (Configuration) new Configuration().configure();
		 ServiceRegistry  sr =  new StandardServiceRegistryBuilder().applySettings(config.getProperties()).build();
		 return  config.buildSessionFactory(sr);
 }
	public static SessionFactory getSf() {
		// TODO Auto-generated method stub
		return sf;
	}
	 
}
